package com.andy.buyu.server.entity;

import org.apache.commons.lang3.RandomUtils;

import com.andy.buyu.server.utils.ListTuple;

public class ConfFish extends BaseEntity{

	private static final long serialVersionUID = 1L;

	public ConfFish() {
	}
	
	public ConfFish(Long id) {
		super(id);
	}
	
	private Integer probability;
	
	private Integer type;
	
	private Integer func;
	
	private Integer fishId;
	
	private String name;
	
	private String assets;
	
	private String multiple;
	
	private String sound;

	public static String table() {
		return "conf_fish";
	}

	public Integer getProbability() {
		return probability;
	}

	public void setProbability(Integer probability) {
		this.probability = probability;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getFishId() {
		return fishId;
	}

	public void setFishId(Integer fishId) {
		this.fishId = fishId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAssets() {
		return assets;
	}

	public void setAssets(String assets) {
		this.assets = assets;
	}

	public String getMultiple() {
		return multiple;
	}

	public void setMultiple(String multiple) {
		this.multiple = multiple;
	}

	private ListTuple listTuple;
	public ListTuple listTuple(){
		if(listTuple == null){
			listTuple = new ListTuple(multiple);
		}
		return listTuple;
	}
	/**
	 * 试着捕获，返回倍率
	 * @return -1,没有捕获
	 */
	public int tryRate(boolean isMust){
		if(isMust || RandomUtils.nextInt(0, 10000) < probability){
			return listTuple().selTuple().getFir();
		}
		return -1;
	}

	public Integer getFunc() {
		return func;
	}

	public void setFunc(Integer func) {
		this.func = func;
	}

	public String getSound() {
		return sound;
	}

	public void setSound(String sound) {
		this.sound = sound;
	}

}
